home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: int main() vs int main(void)
- Date: 08 Feb 1996 15:43:18 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Feb8084318@qcd.lanl.gov>
- References: <1996Feb7.201848.18734@atlas.tntech.edu>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: jad7084@tntech.edu's message of 7 Feb 96 20:18:48 -0500
-
- In article <1996Feb7.201848.18734@atlas.tntech.edu> jad7084@tntech.edu
- (Jim Davis) writes:
- <snip>
- Okay, void main() is naughty, but there's something else I've been
- wondering about, and I can't find it in the FAQ.
-
- Is there a difference between
-
- int main()
- int main(void)
-
- ? () is equivalent to (void), right? Does it matter? Am I worried about
- nothing?
-
- int main() in the definition (the only normal use :-) is equivalent to
- int main(void). In a declaration (if you want to declare a function
- before defining or otherwise using it), int main() means that main has
- a fixed number of parameters which is not being declared here: that is
- also correct.
-
- Only things to check out for the type of main are:
-
- 1) it returns an int.
- 2) it has either no parameters
- or two parameters
- 3) it is not a vararg function (i.e. you cannot sometime call it with
- 0 and sometime with 2 parameters: neither can you declare it to
- take a varying number of parameters.)
- 4) if it has two parameters, the first is an int
- and the second is char *argv[], which _in parameter context_ is same
- as char **argv.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-